package com.hs.myshell.demo.swt;

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.*;


//https://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet245.java
public class Snippet245 {

public static void main(String [] args) {
	System.out.println(SWT.Paint);
	System.out.println(SWT.Resize);
	System.out.println(SWT.Selection);
	var display = new Display();
	var shell = new Shell(display);
	shell.setText("Snippet 245");
	shell.addPaintListener(event -> {
		Rectangle rect = shell.getClientArea();
		event.gc.drawOval(0, 0, rect.width - 1, rect.height - 1);
	});
	Rectangle clientArea = shell.getClientArea();
	shell.setBounds(clientArea.x + 10, clientArea.y + 10, 200, 200);
	shell.open ();
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch()) display.sleep();
	}
	display.dispose();
}
}